﻿<!DOCTYPE HTML>
<html>

	<head>
		<meta charset="utf-8">
		<meta name="renderer" content="webkit|ie-comp|ie-stand">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta http-equiv="Cache-Control" content="no-siteapp" />
		<!--[if lt IE 9]>
		<script type="text/javascript" src="__ADMIN__/lib/html5shiv.js"></script>
		<script type="text/javascript" src="__ADMIN__/lib/respond.min.js"></script>
		<![endif]-->
		<link href="__ADMIN__/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css" />
		<link href="__ADMIN__/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css" />
		<link href="__ADMIN__/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css" />
		<link href="__ADMIN__/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css" />
		<!--[if IE 6]>
		<script type="text/javascript" src="__ADMIN__/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
		<script>DD_belatedPNG.fix('*');</script>
		<![endif]-->
		<title>总后台管理</title>
	</head>

	<body>
		<div style="text-align: center; font-size: 18px; color:#fff;">总后台管理</div>
		<div class="loginWraper">
			<div id="loginform" class="loginBox">
				<form class="form form-horizontal" method="post" id="doLogin">
					<div class="row cl">
						<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
						<div class="formControls col-xs-8">
							<input id="admin_name" name="admin_name" type="text" placeholder="用户名" class="input-text size-L">
						</div>
					</div>
					<div class="row cl">
						<label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
						<div class="formControls col-xs-8">
							<input id="admin_password" name="admin_password" type="password" placeholder="密码" class="input-text size-L">
						</div>
					</div>
					<div class="row cl">
						<div class="formControls col-xs-8 col-xs-offset-3">
							<input type="text" id="verify" name="verify" maxlength="5" class="input-text size-L" style="color: #000000; width: 50%; float: left;margin-top: -2px;" placeholder="验证码" autocomplete="off" />
							<img id="verify_img" src="{:captcha_src()}" alt="验证码" onclick="refreshVerify()" style="float:right; width: 38%;height:40px;float: left; margin-left: 5px;">
						</div>
						<div class="row cl">
							<div class="formControls col-xs-8 col-xs-offset-3">
							</div>
						</div>
						<div class="row cl">
							<div class="formControls col-xs-8 col-xs-offset-3">
								<input name="" id='btn' type="button" class="btn btn-success radius size-L" value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;">
								<input name="" type="reset" class="btn btn-default radius size-L" value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
							</div>
						</div>
				</form>

				</div>
			</div>
			<div class="footer">Copyright 龙技术 v4.0</div>
			<script type="text/javascript" src="__ADMIN__/lib/jquery/1.9.1/jquery.min.js"></script>
			<script type="text/javascript" src="__ADMIN__/static/h-ui/js/H-ui.js"></script>
			<script type="text/javascript" src="__ADMIN__/static/layer/layer.min.js"></script>
	</body>

</html>

<script>
	function refreshVerify() {
		var ts = Date.parse(new Date()) / 1000;
		var img = document.getElementById('verify_img');
		img.src = "/captcha?id=" + ts;
	}
</script>
<script>
	$('#btn').click(function() {
		var admin_name = $("#admin_name").val();
		var admin_password = $("#admin_password").val();
		var verify = $("#verify").val();
		if(admin_name == '') {
			layer.msg('用户名不能为空');
			return;
		}

		if(admin_password.trim() == '') {
			layer.msg('密码不能为空');
			return;
		}
		if(verify.trim() == '') {
			layer.msg('请输入验证码');
			return;
		}

		$.ajax({
			url: "{:url('login/dologin')}",
			type: 'post',
			async: false,
			data: {
				admin_name: admin_name,
				admin_password: admin_password,
				verify: verify
			},
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					}, function() {
						location.reload();
					});
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			}
		})
	});
</script>